# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=keimpx
pkgver=300.37190f4
pkgrel=7
epoch=3
groups=('blackarch' 'blackarch-cracker')
pkgdesc='Tool to verify the usefulness of credentials across a network over SMB.'
url='http://code.google.com/p/keimpx/'
license=('Apache')
depends=('python' 'impacket' 'python-pycryptodome')
makedepends=('git' 'python-distribute')
arch=('any')
source=("git+https://github.com/inquisb/$pkgname.git"
        'setup.py-remove_py2exe.patch')
sha512sums=('SKIP'
            'aec4d1650df3dbf7442c803c7cb7f08739c0a71c7c504cfce09781621cf84a5c8447b2126bde895d8de909dbed3cb9c30c1266bc7c4a647d8a95afbc2e9c5b36')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare() {
  cd $pkgname

  sed -i 's/\/usr\/bin\/env python/\/usr\/bin\/env python/' "$pkgname.py"
  sed -i 's/keimpx_path =/keimpx_path = \"\/usr\/share\/keimpx\" #/' \
    "$pkgname.py"
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md

  rm README.md setup.py

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python $pkgname.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

